home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / var / lib / dpkg / info / consolekit.preinst < prev    next >
Text File  |  2008-10-24  |  2KB  |  63 lines

  1. #!/bin/sh -e
  2. # This script can be called in the following ways:
  3. #
  4. # Before the package is installed:
  5. #    <new-preinst> install
  6. #
  7. # Before removed package is upgraded:
  8. #    <new-preinst> install <old-version>
  9. #
  10. # Before the package is upgraded:
  11. #    <new-preinst> upgrade <old-version>
  12. #
  13. #
  14. # If postrm fails during upgrade or fails on failed upgrade:
  15. #    <old-preinst> abort-upgrade <new-version>
  16.  
  17.  
  18. # remove a no-longer used conffile
  19. rm_conffile()
  20. {
  21.     PKGNAME="$1"
  22.     CONFFILE="$2"
  23.  
  24.     if [ -e "$CONFFILE" ]; then
  25.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  26.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
  27.         if [ "$md5sum" != "$old_md5sum" ]; then
  28.             echo "Obsolete conffile $CONFFILE has been modified by you."
  29.         echo "Saving as $CONFFILE.dpkg-bak ..."
  30.             mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
  31.     else
  32.             echo "Removing obsolete conffile $CONFFILE ..." 
  33.         rm -f "$CONFFILE" 
  34.     fi
  35.     fi
  36. }
  37.  
  38.  
  39. case "$1" in
  40.     install|upgrade)
  41.     # Upgrade from previous versions
  42.     if dpkg --compare-versions "$2" lt "0.2.3-3"; then
  43.         rm_conffile consolekit /etc/init.d/consolekit
  44.         update-rc.d consolekit remove >/dev/null
  45.     fi
  46.     if dpkg --compare-versions "$2" lt-nl "0.2.10-1"; then
  47.             # renamed to 90consolekit
  48.         rm_conffile consolekit /etc/X11/Xsession.d/90-console-kit
  49.     fi
  50.     ;;
  51.  
  52.     abort-upgrade)
  53.     ;;
  54.  
  55.     *)
  56.     echo "$0 called with unknown argument \`$1'" 1>&2
  57.     exit 1
  58.     ;;
  59. esac
  60.  
  61.  
  62. exit 0
  63.